import java.io.PrintStream;
import java.util.Scanner;

/**
 * resolve o GCD LCM 11388
 * @author jonas jeske
 * Status: Accepted !!
 */
public class Main {
	
	public static void main(String[] args){
		Main gcdLcm = new Main();
		gcdLcm.begin();		
	}

	private void begin() {
		
		Scanner entrada = new Scanner(System.in);
		PrintStream saida = new PrintStream(System.out);
		int x,y;
		//long gcdd;		
		int casos;
		casos = entrada.nextInt();
		for(int i=0; i < casos; i++){
			x = entrada.nextInt();
			y = entrada.nextInt();
//			gcdd = gcd(x,y);
//			if( (((x*y)/gcdd) % gcdd) == 0){
//				//eh divisivel
//			} else {
//				saida.printf("-1\n");			
//			}			
			if(y%x != 0){
				saida.printf("-1\n");
			} else {
				saida.printf("%d %d\n",x,y);
			}
		}
		
		
		//34398 2132 = 26		
		//System.out.println(gcd(34398,2132));
		//System.out.println();		
		//lcm
		//34398 * 2132 / gcd(34398,2132);
		
	}
	
	public static long lcm(long a, long b) {		 
			return((a*b)/gcd(a,b));
	}   	
	// a > b  sempre ! cuidar iso !	
	public static long gcd(long a, long b) {		 
		   if (b==0) 
		     return a;
		   else
		     return gcd(b, a % b);
	}   

}
